<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="manifest" href="/images/manifest.json">
  <meta name="msapplication-config" content="/images/browserconfig.xml">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/pace-js@1/themes/blue/pace-theme-minimal.css">
  <script src="//cdn.jsdelivr.net/npm/pace-js@1/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"daydaychen.github.io","root":"/","scheme":"Gemini","version":"7.7.2","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":true,"lazyload":true,"pangu":true,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":true,"nav":null,"activeClass":"valine"},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":true,"preload":false},"motion":{"enable":true,"async":true,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="gitee.com 介绍码云(gitee.com) 代码托管·协作开发平台，开发者近 400 万，托管项目超过 600 万，汇聚几乎所有本土原创开源项目，并于 2016 年推出企业版，提供企业级代码托管服务，成为开发领域领先的 SaaS 服务提供商。 1. 注册 gitee.com 账户 打开 gitee官网， 注册账号并登录  2. 创建仓库 创建仓库    键入仓库信息    仓库名称：任意">
<meta property="og:type" content="article">
<meta property="og:title" content="gitee折腾记录">
<meta property="og:url" content="daydaychen.github.io/2020/03/06/gitee%E6%8A%98%E8%85%BE%E8%AE%B0%E5%BD%95/index.html">
<meta property="og:site_name" content="宁静致远">
<meta property="og:description" content="gitee.com 介绍码云(gitee.com) 代码托管·协作开发平台，开发者近 400 万，托管项目超过 600 万，汇聚几乎所有本土原创开源项目，并于 2016 年推出企业版，提供企业级代码托管服务，成为开发领域领先的 SaaS 服务提供商。 1. 注册 gitee.com 账户 打开 gitee官网， 注册账号并登录  2. 创建仓库 创建仓库    键入仓库信息    仓库名称：任意">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://pic.downk.cc/item/5e60e39498271cb2b8b33976.jpg">
<meta property="og:image" content="https://pic.downk.cc/item/5e60e41598271cb2b8b378d9.jpg">
<meta property="og:image" content="https://pic.downk.cc/item/5e60e7c098271cb2b8b5272d.jpg">
<meta property="og:image" content="https://pic.downk.cc/item/5e60e98198271cb2b8b60b38.jpg">
<meta property="og:image" content="https://pic.downk.cc/item/5e60ea9a98271cb2b8b6bf3b.jpg">
<meta property="og:image" content="https://pic.downk.cc/item/5e60fefc98271cb2b8c187aa.jpg">
<meta property="article:published_time" content="2020-03-06T06:17:18.870Z">
<meta property="article:modified_time" content="2020-03-06T06:17:18.870Z">
<meta property="article:author" content="CT">
<meta property="article:tag" content="gitee">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://pic.downk.cc/item/5e60e39498271cb2b8b33976.jpg">

<link rel="canonical" href="daydaychen.github.io/2020/03/06/gitee%E6%8A%98%E8%85%BE%E8%AE%B0%E5%BD%95/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true
  };
</script>

  <title>gitee折腾记录 | 宁静致远</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">宁静致远</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">this is a subtitle.</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="daydaychen.github.io/2020/03/06/gitee%E6%8A%98%E8%85%BE%E8%AE%B0%E5%BD%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="CT">
      <meta itemprop="description" content="this is a desc.">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="宁静致远">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          gitee折腾记录
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-03-06 14:17:18" itemprop="dateCreated datePublished" datetime="2020-03-06T14:17:18+08:00">2020-03-06</time>
            </span>

          
            <span id="/2020/03/06/gitee%E6%8A%98%E8%85%BE%E8%AE%B0%E5%BD%95/" class="post-meta-item leancloud_visitors" data-flag-title="gitee折腾记录" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2020/03/06/gitee%E6%8A%98%E8%85%BE%E8%AE%B0%E5%BD%95/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2020/03/06/gitee%E6%8A%98%E8%85%BE%E8%AE%B0%E5%BD%95/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="gitee-com-介绍"><a href="#gitee-com-介绍" class="headerlink" title="gitee.com 介绍"></a>gitee.com 介绍</h1><p>码云(gitee.com) 代码托管·协作开发平台，开发者近 400 万，托管项目超过 600 万，汇聚几乎所有本土原创开源项目，并于 2016 年推出企业版，提供企业级代码托管服务，成为开发领域领先的 SaaS 服务提供商。</p>
<h1 id="1-注册-gitee-com-账户"><a href="#1-注册-gitee-com-账户" class="headerlink" title="1. 注册 gitee.com 账户"></a>1. 注册 gitee.com 账户</h1><blockquote>
<p>打开 <a href="https://gitee.com/" target="_blank" rel="noopener">gitee官网</a>， 注册账号并登录</p>
</blockquote>
<h1 id="2-创建仓库"><a href="#2-创建仓库" class="headerlink" title="2. 创建仓库"></a>2. 创建仓库</h1><blockquote>
<p>创建仓库 <img data-src="https://pic.downk.cc/item/5e60e39498271cb2b8b33976.jpg" alt=""></p>
</blockquote>
<blockquote>
<p>键入仓库信息 <img data-src="https://pic.downk.cc/item/5e60e41598271cb2b8b378d9.jpg" alt=""></p>
</blockquote>
<ul>
<li>仓库名称：任意</li>
<li>归属/路径：保持默认即可</li>
<li>仓库介绍：非必填</li>
<li>是否开源：<ul>
<li>私有：拉取代码需要验证用户名和密码</li>
<li>公开：任何人无需验证身份即可直接拉取代码</li>
</ul>
</li>
<li>选择语言：项目代码的语言</li>
<li>添加.gitignore: 该文件用于指定上传代码时不包含项目内的某些文件，譬如包含密码的文件、缓存、项目环境、日志等无用文件，</li>
<li><input disabled="" type="checkbox"> 使用Readme 文件初始化这个仓库：用于介绍项目的文件，建议使用</li>
<li><input disabled="" type="checkbox"> 使用Issue 模板文件初始化这个仓库：初次配置可忽略</li>
<li><input disabled="" type="checkbox"> 使用Pull Request模板文件初始化这个仓库：初次配置可忽略</li>
<li>选择分支模型：初始化仓库时默认只有一个master分支，根据需要设定</li>
</ul>
<blockquote>
<p>点击<img data-src="https://pic.downk.cc/item/5e60e7c098271cb2b8b5272d.jpg" alt=""></p>
</blockquote>
<blockquote>
<p>仓库首页 <img data-src="https://pic.downk.cc/item/5e60e98198271cb2b8b60b38.jpg" alt=""></p>
</blockquote>
<h1 id="3-创建本地仓库-拉取远程仓库"><a href="#3-创建本地仓库-拉取远程仓库" class="headerlink" title="3. 创建本地仓库/拉取远程仓库"></a>3. 创建本地仓库/拉取远程仓库</h1><h2 id="3-1-创建本地仓库"><a href="#3-1-创建本地仓库" class="headerlink" title="3.1 创建本地仓库"></a>3.1 创建本地仓库</h2><blockquote>
<p>在bash环境下操作</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建目录并切换到该目录</span></span><br><span class="line">$ mkdir local_repo &amp;&amp; <span class="built_in">cd</span> local_repo</span><br><span class="line"></span><br><span class="line"><span class="comment"># 初始化仓库</span></span><br><span class="line">$ git init</span><br></pre></td></tr></table></figure>

<h2 id="3-2-拉取远程仓库"><a href="#3-2-拉取远程仓库" class="headerlink" title="3.2 拉取远程仓库"></a>3.2 拉取远程仓库</h2><blockquote>
<p>获取远程仓库链接</p>
</blockquote>
<p><img data-src="https://pic.downk.cc/item/5e60ea9a98271cb2b8b6bf3b.jpg" alt=""></p>
<blockquote>
<p>拉取代码</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 拉取远程仓库到本地目录learn_git</span></span><br><span class="line">$ git <span class="built_in">clone</span> https://gitee.com/daydaychen/learn_git.git learn_git</span><br><span class="line">Cloning into <span class="string">'learn_git'</span>...</span><br><span class="line">remote: Enumerating objects: 4, <span class="keyword">done</span>.</span><br><span class="line">remote: Counting objects: 100% (4/4), <span class="keyword">done</span>.</span><br><span class="line">remote: Compressing objects: 100% (4/4), <span class="keyword">done</span>.</span><br><span class="line">remote: Total 4 (delta 0), reused 0 (delta 0)</span><br><span class="line">Unpacking objects: 100% (4/4), <span class="keyword">done</span>.</span><br><span class="line">Checking connectivity... <span class="keyword">done</span>.</span><br></pre></td></tr></table></figure>

<h1 id="4-跟踪文件-取消跟踪"><a href="#4-跟踪文件-取消跟踪" class="headerlink" title="4. 跟踪文件/取消跟踪"></a>4. 跟踪文件/取消跟踪</h1><blockquote>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 当前目录下有两个文件</span></span><br><span class="line">dayday:learn_git$ ls</span><br><span class="line">total 8.0K</span><br><span class="line">-rw-rw-rw- 1 dayday dayday  953 Mar  5 20:06 README.en.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday 1.3K Mar  5 20:06 README.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 新建文件</span></span><br><span class="line">$ <span class="built_in">echo</span> <span class="string">"hello world"</span> &gt; day1_work.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看工作区状态</span></span><br><span class="line">dayday:learn_git$ git status</span><br><span class="line">On branch master</span><br><span class="line">Your branch is up-to-date with <span class="string">'origin/master'</span>.</span><br><span class="line">Untracked files: <span class="comment"># &lt;-- 有以下文件未跟踪</span></span><br><span class="line">  (use <span class="string">"git add &lt;file&gt;..."</span> to include <span class="keyword">in</span> what will be committed)</span><br><span class="line"></span><br><span class="line">        day1_work.md</span><br><span class="line"></span><br><span class="line">nothing added to commit but untracked files present (use <span class="string">"git add"</span> to track)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 跟踪day1_work.md</span></span><br><span class="line">$ git add day1_work.md</span><br><span class="line">On branch master</span><br><span class="line">Your branch is up-to-date with <span class="string">'origin/master'</span>.</span><br><span class="line">Changes to be committed: <span class="comment"># &lt;-- 有以下文件已修改未提交</span></span><br><span class="line">  (use <span class="string">"git reset HEAD &lt;file&gt;..."</span> to unstage)</span><br><span class="line">        new file:   day1_work.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 提交修改</span></span><br><span class="line">dayday:learn_git$ git commit -m <span class="string">'first commit'</span></span><br><span class="line">[master b52affd] first commit</span><br><span class="line"> 1 file changed, 1 insertion(+)</span><br><span class="line"> create mode 100644 day1_work.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看工作区状态</span></span><br><span class="line">dayday:learn_git$ git status</span><br><span class="line">On branch master</span><br><span class="line">Your branch is ahead of <span class="string">'origin/master'</span> by 1 commit.</span><br><span class="line">(use <span class="string">"git push"</span> to publish your <span class="built_in">local</span> commits)</span><br><span class="line">nothing to commit, working directory clean</span><br></pre></td></tr></table></figure>

<h1 id="5-创建分支-切换分支-删除分支"><a href="#5-创建分支-切换分支-删除分支" class="headerlink" title="5. 创建分支/切换分支/删除分支"></a>5. 创建分支/切换分支/删除分支</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 列出所有分支</span></span><br><span class="line">dayday:learn_git$ git branch --list</span><br><span class="line">* master</span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建dev分支</span></span><br><span class="line">dayday:learn_git$ git branch dev</span><br><span class="line">dayday:learn_git$ git branch --list</span><br><span class="line">dev</span><br><span class="line">* master</span><br><span class="line"></span><br><span class="line"><span class="comment"># 切换到dev分支</span></span><br><span class="line">dayday:learn_git$ git checkout dev</span><br><span class="line">Switched to branch <span class="string">'dev'</span></span><br><span class="line">dayday:learn_git$ git branch --list</span><br><span class="line">* dev</span><br><span class="line">master</span><br><span class="line"></span><br><span class="line"><span class="comment"># 切换回master分支</span></span><br><span class="line">dayday:learn_git$ git checkout master</span><br><span class="line">Switched to branch <span class="string">'master'</span></span><br><span class="line">Your branch is ahead of <span class="string">'origin/master'</span> by 1 commit.</span><br><span class="line">(use <span class="string">"git push"</span> to publish your <span class="built_in">local</span> commits) </span><br><span class="line"></span><br><span class="line"><span class="comment"># 删除dev分支</span></span><br><span class="line">dayday:learn_git$ git branch -d dev</span><br><span class="line">Deleted branch dev (was b52affd).</span><br></pre></td></tr></table></figure>
<h1 id="8-合并分支"><a href="#8-合并分支" class="headerlink" title="8. 合并分支"></a>8. 合并分支</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建dev分支并切换过去</span></span><br><span class="line">dayday:learn_git$ git checkout -b dev</span><br><span class="line">Switched to a new branch <span class="string">'dev'</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 新建文件</span></span><br><span class="line">dayday:learn_git$ <span class="built_in">echo</span> <span class="string">"dev branch working..."</span> &gt; dev.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看dev分支工作区</span></span><br><span class="line">dayday:learn_git$ ls</span><br><span class="line">total 8.0K</span><br><span class="line">-rw-rw-rw- 1 dayday dayday  953 Mar  5 20:06 README.en.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday 1.3K Mar  5 20:06 README.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday   12 Mar  5 20:12 day1_work.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday   22 Mar  5 20:44 dev.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 跟踪dev.md</span></span><br><span class="line">dayday:learn_git$ git add .</span><br><span class="line"></span><br><span class="line"><span class="comment"># 提交更改</span></span><br><span class="line">dayday:learn_git$ git commit -m <span class="string">'add dev.md'</span></span><br><span class="line">[dev a6986a9] add dev.md</span><br><span class="line">1 file changed, 1 insertion(+)</span><br><span class="line">create mode 100644 dev.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 切换到master分支</span></span><br><span class="line">dayday:learn_git$ git checkout master</span><br><span class="line">Switched to branch <span class="string">'master'</span></span><br><span class="line">Your branch is ahead of <span class="string">'origin/master'</span> by 1 commit.</span><br><span class="line">(use <span class="string">"git push"</span> to publish your <span class="built_in">local</span> commits) </span><br><span class="line"></span><br><span class="line">dayday:learn_git$ git branch</span><br><span class="line">dev</span><br><span class="line">* master</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看master分支工作区</span></span><br><span class="line">dayday:learn_git$ ls</span><br><span class="line">total 8.0K</span><br><span class="line">-rw-rw-rw- 1 dayday dayday  953 Mar  5 20:06 README.en.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday 1.3K Mar  5 20:06 README.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday   12 Mar  5 20:12 day1_work.md</span><br><span class="line"></span><br><span class="line"><span class="comment"># 比较master分支和dev分支的区别</span></span><br><span class="line">dayday:learn_git$ git diff master dev</span><br><span class="line">diff --git a/dev.md b/dev.md</span><br><span class="line">new file mode 100644</span><br><span class="line">index 0000000..c38f76b</span><br><span class="line">--- /dev/null</span><br><span class="line">+++ b/dev.md</span><br><span class="line">@@ -0,0 +1 @@</span><br><span class="line">+dev branch working...</span><br><span class="line"></span><br><span class="line"><span class="comment"># 合并dev分支到master分支</span></span><br><span class="line">dayday:learn_git$ git merge dev</span><br><span class="line">Updating b52affd..a6986a9 Fast-forward</span><br><span class="line">dev.md | 1 + 1 file changed, 1 insertion(+)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看master分支工作区</span></span><br><span class="line">create mode 100644 dev.mddayday:learn_git$ ls</span><br><span class="line">total 8.0K</span><br><span class="line">-rw-rw-rw- 1 dayday dayday  953 Mar  5 20:06 README.en.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday 1.3K Mar  5 20:06 README.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday   12 Mar  5 20:12 day1_work.md</span><br><span class="line">-rw-rw-rw- 1 dayday dayday   22 Mar  5 20:53 dev.md</span><br></pre></td></tr></table></figure>


<h1 id="11-推送的远程仓库"><a href="#11-推送的远程仓库" class="headerlink" title="11. 推送的远程仓库"></a>11. 推送的远程仓库</h1><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查看工作区状态</span></span><br><span class="line">dayday:learn_git$ git status</span><br><span class="line">On branch master</span><br><span class="line">Your branch is ahead of <span class="string">'origin/master'</span> by 2 commits.</span><br><span class="line">(use <span class="string">"git push"</span> to publish your <span class="built_in">local</span> commits)</span><br><span class="line">nothing to commit, working directory clean </span><br><span class="line"></span><br><span class="line"><span class="comment"># 推送到远程仓库</span></span><br><span class="line">dayday:learn_git$ git push origin master</span><br><span class="line">Username <span class="keyword">for</span> <span class="string">'https://gitee.com'</span>: daydaychen</span><br><span class="line">Password <span class="keyword">for</span> <span class="string">'https://daydaychen@gitee.com'</span>:</span><br><span class="line">Counting objects: 6, <span class="keyword">done</span>.</span><br><span class="line">Delta compression using up to 4 threads.</span><br><span class="line">Compressing objects: 100% (4/4), <span class="keyword">done</span>.</span><br><span class="line">Writing objects: 100% (6/6), 537 bytes | 0 bytes/s, <span class="keyword">done</span>.</span><br><span class="line">Total 6 (delta 1), reused 0 (delta 0)</span><br><span class="line">remote: Powered by GITEE.COM [GNK-3.8]</span><br><span class="line">To https://gitee.com/daydaychen/learn_git.git</span><br><span class="line">4618244..a6986a9  master -&gt; master</span><br></pre></td></tr></table></figure>

<h1 id="12-向一个项目贡献"><a href="#12-向一个项目贡献" class="headerlink" title="12 向一个项目贡献"></a>12 向一个项目贡献</h1><blockquote>
<p>fork 仓库</p>
</blockquote>
<blockquote>
<p>拉取远程仓库到本地</p>
</blockquote>
<blockquote>
<p>提交修改并推送到远程仓库</p>
</blockquote>
<blockquote>
<p>提交Pull Request</p>
</blockquote>
<h1 id="13-仓库设置说明"><a href="#13-仓库设置说明" class="headerlink" title="13 仓库设置说明"></a>13 仓库设置说明</h1><blockquote>
<p>仓库成员管理</p>
</blockquote>
<p>添加成员，按角色分配仓库的读写权限</p>
<blockquote>
<p>部署公钥管理</p>
</blockquote>
<p>该操作通过非对称加密密钥对对仓库进行访问验证，无需每次输入用户名密码</p>
<p><img data-src="https://pic.downk.cc/item/5e60fefc98271cb2b8c187aa.jpg" alt=""></p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/gitee/" rel="tag"># gitee</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/03/06/%E6%A6%82%E8%BF%B0-over/" rel="prev" title="计算机网络-概述">
      <i class="fa fa-chevron-left"></i> 计算机网络-概述
    </a></div>
      <div class="post-nav-item"></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#gitee-com-介绍"><span class="nav-number">1.</span> <span class="nav-text">gitee.com 介绍</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#1-注册-gitee-com-账户"><span class="nav-number">2.</span> <span class="nav-text">1. 注册 gitee.com 账户</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-创建仓库"><span class="nav-number">3.</span> <span class="nav-text">2. 创建仓库</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-创建本地仓库-拉取远程仓库"><span class="nav-number">4.</span> <span class="nav-text">3. 创建本地仓库&#x2F;拉取远程仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#3-1-创建本地仓库"><span class="nav-number">4.1.</span> <span class="nav-text">3.1 创建本地仓库</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-2-拉取远程仓库"><span class="nav-number">4.2.</span> <span class="nav-text">3.2 拉取远程仓库</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#4-跟踪文件-取消跟踪"><span class="nav-number">5.</span> <span class="nav-text">4. 跟踪文件&#x2F;取消跟踪</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#5-创建分支-切换分支-删除分支"><span class="nav-number">6.</span> <span class="nav-text">5. 创建分支&#x2F;切换分支&#x2F;删除分支</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#8-合并分支"><span class="nav-number">7.</span> <span class="nav-text">8. 合并分支</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#11-推送的远程仓库"><span class="nav-number">8.</span> <span class="nav-text">11. 推送的远程仓库</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#12-向一个项目贡献"><span class="nav-number">9.</span> <span class="nav-text">12 向一个项目贡献</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#13-仓库设置说明"><span class="nav-number">10.</span> <span class="nav-text">13 仓库设置说明</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="CT"
      src="/images/avatar.gif">
  <p class="site-author-name" itemprop="name">CT</p>
  <div class="site-description" itemprop="description">this is a desc.</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">16</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">5</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/daydaychen" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;daydaychen" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:ctt0120@foxmail.com" title="E-Mail → mailto:ctt0120@foxmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
  </div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>



      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">CT</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v4.2.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.7.2
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="//cdn.jsdelivr.net/npm/animejs@3.1.0/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/medium-zoom@1/dist/medium-zoom.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/velocity-animate@1/velocity.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/velocity-animate@1/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>

  <script>
var pjax = new Pjax({
  selectors: [
    'head title',
    '#page-configurations',
    '.content-wrap',
    '.post-toc-wrap',
    '#pjax'
  ],
  switches: {
    '.post-toc-wrap': Pjax.switches.innerHTML
  },
  analytics: false,
  cacheBust: false,
  scrollTo : !CONFIG.bookmark.enable
});

window.addEventListener('pjax:success', () => {
  document.querySelectorAll('script[pjax], script#page-configurations, #pjax script').forEach(element => {
    var code = element.text || element.textContent || element.innerHTML || '';
    var parent = element.parentNode;
    parent.removeChild(element);
    var script = document.createElement('script');
    if (element.id) {
      script.id = element.id;
    }
    if (element.className) {
      script.className = element.className;
    }
    if (element.type) {
      script.type = element.type;
    }
    if (element.src) {
      script.src = element.src;
      // Force synchronous loading of peripheral JS.
      script.async = false;
    }
    if (element.getAttribute('pjax') !== null) {
      script.setAttribute('pjax', '');
    }
    if (code !== '') {
      script.appendChild(document.createTextNode(code));
    }
    parent.appendChild(script);
  });
  NexT.boot.refresh();
  // Define Motion Sequence & Bootstrap Motion.
  if (CONFIG.motion.enable) {
    NexT.motion.integrator
      .init()
      .add(NexT.motion.middleWares.subMenu)
      .add(NexT.motion.middleWares.postList)
      .bootstrap();
  }
  NexT.utils.updateSidebarPosition();
});
</script>




  




  
<script src="/js/local-search.js"></script>













    <div id="pjax">
  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/valine@1/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : '9bBjpz3HRuKNuKNp7T27dFsT-gzGzoHsz',
      appKey     : 'k2pzqGWjkjrKxlFLQ3O0oqDn',
      placeholder: "Just go go",
      avatar     : 'robohash',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : 'zh-cn' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

    </div>
</body>
</html>
